package com.egoo.ticket.server.utils.common;//package com.egoo.ews.service.utils.common;
//
//import com.alibaba.fastjson.JSON;
//import com.alibaba.fastjson.JSONObject;
//import org.apache.ibatis.type.BaseTypeHandler;
//import org.apache.ibatis.type.JdbcType;
//import org.apache.ibatis.type.MappedTypes;
//import org.postgresql.utils.PGobject;
//
//import java.sql.CallableStatement;
//import java.sql.PreparedStatement;
//import java.sql.ResultSet;
//import java.sql.SQLException;
//
///**
// * @author Administrator
// */
//@MappedTypes(Object.class)
//public class JsonTypeHandlerPg extends BaseTypeHandler<Object> {
//
//	private static final PGobject JSONOBJECT = new PGobject();
//
//	@Override
//	public void setNonNullParameter(PreparedStatement ps, int i, Object parameter, JdbcType jdbcType)
//			throws SQLException {
//		JSONOBJECT.setType("json");
//		JSONOBJECT.setValue(parameter.toString());
//		ps.setObject(i, JSONOBJECT);
//	}
//
//	@Override
//	public Object getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
//		JSONObject jsonObject = JSON.parseObject(rs.getString(columnIndex));
//		return jsonObject;
//	}
//
//	@Override
//	public Object getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
//		JSONObject jsonObject = JSON.parseObject(cs.getString(columnIndex));
//		return jsonObject;
//	}
//
//	@Override
//	public Object getNullableResult(ResultSet rs, String columnName) throws SQLException {
//		JSONObject jsonObject = JSON.parseObject(rs.getString(columnName));
//		return jsonObject;
//	}
//}
